home *** CD-ROM | disk | FTP | other *** search
-
-
- #include "FRGameLogo.h"
-
- #include "FRCop.h"
- #include "FRAmbulance.h"
- #include "FRGolf.h"
- #include "FRFuneralCar.h"
-
- TERTTIImplementation(FRCloakLogo, TEEngineObject);
- TERTTIImplementation(FRLoserGolf, FRCar);
-
- TESoundReference* FRGameLogo::ms_pTechno = NULL;
- TESoundReference* FRGameLogo::ms_pCrash = NULL;
- UInt32 FRGameLogo::ms_ulLogoStart = 0;
- UInt32 FRGameLogo::ms_ulLogoState = 0;
-
- void FRGameLogo::Start(void)
- {
- Initialize();
- Loop();
- Cleanup();
- }
-
- void FRGameLogo::Initialize(void)
- {
- TEString Str = "techno.ogg";
- TESoundManager* pSound = TESoundManager::GetSoundManager();
-
- ms_pTechno = pSound->GetSound(Str);
- Str = "crash.ogg";
- ms_pCrash = pSound->GetSound(Str);
-
- Str = "load funracing-logo.bsp";
- TEConsole::GetConsole()->EnterCommand(Str, true);
-
- ms_ulLogoState = 1;
- ms_ulLogoStart = TETimer::GetTimer()->GetTime();
- }
-
- void FRGameLogo::Cleanup(void)
- {
- TEString Str = "unload";
-
- TEConsole::GetConsole()->EnterCommand(Str, true);
-
- SafeDelete(ms_pTechno);
- SafeDelete(ms_pCrash);
- ms_ulLogoState = 0;
- ms_ulLogoStart = 0;
- }
-
- void FRGameLogo::Loop(void)
- {
- TEEngine* pEngine = TEEngine::GetEngine();
- TERenderer* pRender = TERenderer::GetRenderer();
- TECamera* pCam = pRender->GetCamera();
- TEInputDevices* pInput = TEInputDevices::GetInputDevices();
- TETimer* pTimer = TETimer::GetTimer();
- UInt32 ulTime = pTimer->GetTime() - ms_ulLogoStart;
- TEVector Vec, Up = TEVector(0, 1, 0);
- TEParticleFX* pPart;
- FRLoserGolf* pGolf;
- FRCar *pAmb, *pFun;
- FRCloakLogo* pLogo;
-
- pEngine->ShowCursor(false);
- Vec = TEVector(85, 50, -85);
- pCam->SetPosition(Vec);
- Vec = TEVector(-20, 42, 0);
- pCam->SetRotation(Vec);
-
- Vec = TEVector(160.0f, 5.0f, 47.5f);
- pGolf = new FRLoserGolf(Vec, 270);
- pGolf->m_State = RACING;
- pGolf->SetPedal(1.0f);
-
- pEngine->AddObjectToWorld(pGolf);
-
- ms_pTechno->Play3D(Vec.m_fX, Vec.m_fY, Vec.m_fZ, 0);
-
- while(ulTime < 18500)
- {
- pEngine->Idle();
-
- if(ms_ulLogoState == 1)
- {
- Vec = pGolf->GetCenter();
- ms_pTechno->UpdatePosition(Vec);
-
- if(Vec.m_fX < 30.0f)
- {
- ms_ulLogoState = 2;
- pGolf->Brake();
- }
- }
-
- if(ms_ulLogoState == 2)
- {
- Vec = pGolf->GetCenter();
-
- if(Vec.m_fX < -62.0f)
- {
- ms_ulLogoState = 3;
- pGolf->Stop();
- pGolf->m_State = DESTROYED;
- ms_pCrash->Play(0, 4.0f);
-
- Vec.m_fX -= 4.0f;
- Vec.m_fY += 6.0f;
- pPart = new TEParticleFX(Vec, 2, 4, 2.0f, 0, 0, 0, Up, 200, 1300,
- 255, 1.0f, true, false);
- pPart->SetColor(255, 128, 64);
- pEngine->AddParticleSystem(pPart);
- }
- }
-
- if(ms_ulLogoState == 3 && ulTime > 6300)
- {
- Vec = TEVector(160.0f, 5.0f, 47.5f);
- pAmb = new FRAmbulance(Vec, 270);
- pAmb->m_State = RACING;
- pAmb->Horn();
- pAmb->SetPedal(0.5f);
- pEngine->AddObjectToWorld(pAmb);
- ms_ulLogoState = 4;
- }
- if(ms_ulLogoState == 4)
- {
- Vec = pAmb->GetCenter();
-
- if(Vec.m_fX < 45.0f)
- {
- pAmb->SetPedal(0.0f);
- pAmb->SetHandbrake(true);
- ms_ulLogoState = 5;
- }
- }
- if(ms_ulLogoState == 5)
- {
- Vec = pAmb->GetCenter();
-
- if(Vec.m_fX < 30.0f || pAmb->GetGear() < FIRST_GEAR)
- {
- pAmb->Horn();
- pAmb->m_State = DESTROYED;
- Vec = TEVector(0,0,0);
- pAmb->SetAcceleration(Vec);
- pAmb->SetVelocity(Vec);
- ms_ulLogoState = 6;
- }
- }
-
- if(ms_ulLogoState > 5)
- {
- Vec = TEVector(0,0,0);
- pAmb->SetAcceleration(Vec);
- pAmb->SetVelocity(Vec);
- }
-
- if(ms_ulLogoState == 6)
- {
- Vec = TEVector(-47.5f, 5.0f, -175.0f);
- pFun = new FRFuneralCar(Vec, 0);
- pFun->m_State = RACING;
- pFun->SetPedal(1.0f);
- pEngine->AddObjectToWorld(pFun);
- ms_ulLogoState = 7;
- }
-
- if(ms_ulLogoState == 7)
- {
- Vec = pFun->GetCenter();
-
- if(Vec.m_fZ > -50.0f)
- {
- pFun->SetPedal(-0.5f);
- pFun->SetHandbrake(true);
- ms_ulLogoState = 8;
- }
- }
-
- if(ms_ulLogoState == 8)
- {
- Vec = pFun->GetCenter();
-
- if(Vec.m_fZ > -45.0f || pFun->GetGear() < FIRST_GEAR)
- {
- pFun->SetPedal(0.0f);
- Vec = TEVector(0,0,0);
- pFun->SetAcceleration(Vec);
- pFun->SetVelocity(Vec);
- pFun->m_State = DESTROYED;
- ms_ulLogoState = 9;
- }
- }
-
- if(ms_ulLogoState > 8)
- {
- Vec = TEVector(0,0,0);
- pFun->SetAcceleration(Vec);
- pFun->SetVelocity(Vec);
- }
-
- if(ms_ulLogoState == 9 && ulTime > 13000)
- {
- pLogo = new FRCloakLogo;
- pEngine->AddObjectToWorld(pLogo);
- ms_ulLogoState = 10;
- }
-
- ulTime = pTimer->GetTime() - ms_ulLogoStart;
-
- if(pInput->IsPressed(TE_KEY_ESCAPE) ||
- pInput->IsPressed(TE_KEY_ENTER) ||
- pInput->IsPressed(TE_KEY_SPACE))
- break;
- }
-
- pEngine->FreeAllDecals();
- pEngine->FreeAllObjectsInWorld();
- pEngine->FreeAllParticleSystems();
- }